﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TradingAppDal;
using System.Threading;
using System.Data.SqlTypes;

namespace WC.Taxation
{
    public class WCTaxation
    {
        public static void AnalyzeSecurity()
        {
            SecurityDal oSecurityToProcess = new SecurityDal();
            WCTaxation.AnalyzeSecurity(GetTaxationParam(SqlInt64.Null));

        }
        private static WCTaxationParam GetTaxationParam(SqlInt64 SecOrderID)
        {
            SecurityDal oSecurityDal = new SecurityDal();
            WCTaxationParam param = new WCTaxationParam();
            param.lstCorpActions = oSecurityDal.GetSecurityCorpActions(oSecurityDal.SecOrder_ID.Value);
            param.lstDividents = oSecurityDal.GetSecurityDividents(oSecurityDal.SecOrder_ID.Value);
            param.lstIdentifiedStraddles = oSecurityDal.GetSecurityIdentifiedStraddles(oSecurityDal.SecOrder_ID.Value);
            param.lstM1s = oSecurityDal.GetSecurityM1Dal(oSecurityDal.SecOrder_ID.Value);
            param.lstSecurities = oSecurityDal.GetSecuritySecMasters(oSecurityDal.SecOrder_ID.Value);

            param.lstInProcessSecurity = oSecurityDal.GetSecurityInProcess(oSecurityDal.SecOrder_ID.Value);
            param.lstTransactions = oSecurityDal.GetSecurityTransactions(oSecurityDal.SecOrder_ID.Value);
            return param;
        }
        private static Decimal GetRoundedDecimal(Decimal dec)
        {
            return Decimal.Round(dec, 4);
        }
        public static void AnalyzeSecurity(WCTaxationParam TaxationParam)
        {
            // not sorting  the list as we re getting the sorted list from DB
            List<M1Dal> lstM1s = TaxationParam.lstM1s.OrderBy(p => p.Tran_Client_Open_ID).ThenBy(q => q.Tran_Quantity).ToList();
            //open Date, close date, open ID, close ID, quantity
            List<TransactionsDal> lstTransactions = TaxationParam.lstTransactions.OrderBy(od => od.Tran_Open_Trade_Date).ThenBy(cd => cd.Tran_Close_Trade_Date).ThenBy(oid => oid.Tran_Client_Open_ID).ThenBy(cid => cid.Tran_Client_Close_ID).ThenBy(q => q.Tran_Quantity).ToList();
            List<SecMasterDal> lstSecurities = TaxationParam.lstSecurities;
            //Normalize shares
            foreach (TransactionsDal oTrans in lstTransactions)
            {
                SecMasterDal oSecMasterDal = lstSecurities.Find(p => p.Sec_Client_ID == oTrans.Sec_Client_ID);
                oTrans.SecMasterData = oSecMasterDal;
                if (oSecMasterDal != null)
                {
                    oTrans.NewTran_Quantity = GetRoundedDecimal(GetNullReplacement(oTrans.Tran_Quantity) * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract));
                    oTrans.Remain_Quantity = GetRoundedDecimal(GetNullReplacement(oTrans.Tran_Quantity) * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract));
                    //oTrans.NewTran_Quantity = oTrans.Tran_Quantity * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract);
                    //oTrans.Remain_Quantity = oTrans.Tran_Quantity * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract);

                }

            }
            foreach (M1Dal oM1s in lstM1s)
            {
                SecMasterDal oSecMasterDal = lstSecurities.Find(p => p.Sec_Client_ID == oM1s.Sec_Client_ID);
                oM1s.SecMasterData = oSecMasterDal;
                if (oSecMasterDal != null)
                {
                    //oM1s.NewTran_Quantity = oM1s.Tran_Quantity * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract);
                    //oM1s.Remain_Quantity = oM1s.Tran_Quantity * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract);

                    oM1s.NewTran_Quantity = GetRoundedDecimal(GetNullReplacement(oM1s.Tran_Quantity) * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract));
                    oM1s.Remain_Quantity = GetRoundedDecimal(GetNullReplacement(oM1s.Tran_Quantity) * GetNullReplacement(oSecMasterDal.Sec_Client_Und_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Sim_SharesContract) * GetNullReplacement(oSecMasterDal.Sec_Client_Ident_SharesContract));
                }

            }

            //Merge M1s
            Decimal? minQuantity = 0;
            List<MergedDal> lstMerged = new List<MergedDal>();
            for (int ii = lstTransactions.Count; ii-- > 0; )
            {
                for (int i = lstM1s.Count; i-- > 0; )
                {
                    if (lstTransactions[ii].Sec_Client_ID == lstM1s[i].Sec_Client_ID && lstTransactions[ii].Portfolio_Client_ID == lstM1s[i].Portfolio_Client_ID && lstTransactions[ii].Tran_Client_LongShort.ToUpper() == lstM1s[i].Tran_Client_LongShort.ToUpper() && lstTransactions[ii].Tran_Client_Open_ID == lstM1s[i].Tran_Client_Open_ID)
                    {

                        MergedDal oMerged = new MergedDal();

                        //Tran Absolute data
                        oMerged.SecOrder_ID = lstTransactions[ii].SecOrder_ID;
                        oMerged.Process_ID = lstTransactions[ii].Process_ID;
                        oMerged.Portfolio_Client_ID = lstTransactions[ii].Portfolio_Client_ID;
                        oMerged.Sec_Client_ID = lstTransactions[ii].Sec_Client_ID;
                        oMerged.Tran_Option_ASP = lstTransactions[ii].Tran_Option_ASP;
                        oMerged.Tran_Client_Transaction_Code = lstTransactions[ii].Tran_Client_Transaction_Code;
                        oMerged.Tran_Client_Open_ID = lstTransactions[ii].Tran_Client_Open_ID;
                        oMerged.Tran_Open_Trade_Date = lstTransactions[ii].Tran_Open_Trade_Date;
                        oMerged.Tran_Client_Close_ID = lstTransactions[ii].Tran_Client_Close_ID;
                        oMerged.Tran_Close_Trade_Date = lstTransactions[ii].Tran_Close_Trade_Date;
                        oMerged.Tran_Client_LongShort = lstTransactions[ii].Tran_Client_LongShort.ToUpper();
                        oMerged.Tran_GainLoss_Character = lstTransactions[ii].Tran_GainLoss_Character;

                        //M1 Absolute data
                        oMerged.WashSales_AssignedFrom_Portfolio_ID = lstM1s[i].WashSales_AssignedFrom_Portfolio_ID;
                        oMerged.WashSales_AssignedFrom_Open_ID = lstM1s[i].WashSales_AssignedFrom_Open_ID;
                        oMerged.WashSales_AssignedFrom_Close_ID = lstM1s[i].WashSales_AssignedFrom_Close_ID;
                        oMerged.WashSales_TackedDays = lstM1s[i].WashSales_TackedDays;
                        oMerged.WashSales_LossDate = lstM1s[i].WashSales_LossDate;
                        oMerged.WashSales_Unique_From_ID = lstM1s[i].WashSales_Unique_From_ID;

                        //Get minimum Quantity
                        if (lstTransactions[ii].Remain_Quantity <= lstM1s[i].Remain_Quantity)
                        {
                            minQuantity = lstTransactions[ii].Remain_Quantity;
                        }
                        else
                        {
                            minQuantity = lstM1s[i].Remain_Quantity;
                        }

                        //Prorata Data
                        oMerged.Tran_Quantity = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Quantity;
                        oMerged.NewTran_Quantity = minQuantity;
                        oMerged.Tran_Orig_Cost_Base = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Orig_Cost_Base;
                        oMerged.Tran_Amort_Cost_Base = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Amort_Cost_Base;
                        oMerged.Tran_ProceedsMarket_Principle_Base = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_ProceedsMarket_Principle_Base;
                        oMerged.Tran_GainLoss_Exchange = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_GainLoss_Exchange;
                        oMerged.Tran_GainLoss_Capital = minQuantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_GainLoss_Capital;
                        oMerged.WashSales_Exchange_Adjustment = minQuantity / lstM1s[i].NewTran_Quantity * lstM1s[i].WashSales_Exchange_Adjustment;
                        oMerged.WashSales_Capital_Adjustment = minQuantity / lstM1s[i].NewTran_Quantity * lstM1s[i].WashSales_Capital_Adjustment;

                        // to be confirmed by Polan 
                        oMerged.SecMasterData = lstTransactions[ii].SecMasterData;
                        lstMerged.Add(oMerged);

                        //Reset remaining Quanitity
                        lstM1s[i].Remain_Quantity = lstM1s[i].Remain_Quantity - minQuantity;
                        lstTransactions[ii].Remain_Quantity = lstTransactions[ii].Remain_Quantity - minQuantity;
                    }


                    if (lstM1s[i].Remain_Quantity >= 0)
                    {
                        lstM1s.Remove(lstM1s[i]);
                    }
                    if (lstTransactions[ii].Remain_Quantity == 0)
                    {
                        break;
                    }
                }
                if (lstTransactions[ii].Remain_Quantity == 0)
                {
                    lstTransactions.Remove(lstTransactions[ii]);
                }

                //Loop through and get remaining transactions
                for (ii = lstTransactions.Count; ii-- > 0; )
                {
                    if (lstTransactions[ii].Remain_Quantity > 0)
                    {
                        MergedDal oMerged = new MergedDal();
                        oMerged.SecOrder_ID = lstTransactions[ii].SecOrder_ID;
                        oMerged.Process_ID = lstTransactions[ii].Process_ID;
                        oMerged.Portfolio_Client_ID = lstTransactions[ii].Portfolio_Client_ID;
                        oMerged.Sec_Client_ID = lstTransactions[ii].Sec_Client_ID;
                        oMerged.Tran_Option_ASP = lstTransactions[ii].Tran_Option_ASP;
                        oMerged.Tran_Client_Transaction_Code = lstTransactions[ii].Tran_Client_Transaction_Code;
                        oMerged.Tran_Client_Open_ID = lstTransactions[ii].Tran_Client_Open_ID;
                        oMerged.Tran_Open_Trade_Date = lstTransactions[ii].Tran_Open_Trade_Date;
                        oMerged.Tran_Client_Close_ID = lstTransactions[ii].Tran_Client_Close_ID;
                        oMerged.Tran_Close_Trade_Date = lstTransactions[ii].Tran_Close_Trade_Date;
                        oMerged.Tran_Client_LongShort = lstTransactions[ii].Tran_Client_LongShort.ToUpper();
                        oMerged.Tran_GainLoss_Character = lstTransactions[ii].Tran_GainLoss_Character;
                        if (lstTransactions[ii].Remain_Quantity != lstTransactions[ii].Tran_Quantity)
                        {
                            string s = "error";
                        }

                        //SqlDecimal d = lstTransactions[ii].Remain_QuantityDec / lstTransactions[ii].NewTran_QuantityDec;
                        oMerged.Tran_Quantity = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Quantity;

                        oMerged.NewTran_Quantity = lstTransactions[ii].Remain_Quantity;
                        oMerged.Tran_Orig_Cost_Base = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Orig_Cost_Base;
                        oMerged.Tran_Amort_Cost_Base = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_Amort_Cost_Base;
                        oMerged.Tran_ProceedsMarket_Principle_Base = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_ProceedsMarket_Principle_Base;
                        oMerged.Tran_GainLoss_Exchange = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_GainLoss_Exchange;
                        oMerged.Tran_GainLoss_Capital = lstTransactions[ii].Remain_Quantity / lstTransactions[ii].NewTran_Quantity * lstTransactions[ii].Tran_GainLoss_Capital;
                        oMerged.WashSales_Exchange_Adjustment = 0;
                        oMerged.WashSales_Capital_Adjustment = 0;
                        // to be confirmed by Polan 
                        oMerged.SecMasterData = lstTransactions[ii].SecMasterData;
                        lstMerged.Add(oMerged);
                    }
                }
                for (int i = lstM1s.Count; i-- > 0; )
                {
                    if (lstM1s[i].Remain_Quantity > 0)
                    {
                        MergedDal oMerged = new MergedDal();
                        oMerged.SecOrder_ID = lstM1s[i].SecOrder_ID;
                        oMerged.Process_ID = lstM1s[i].Process_ID;
                        oMerged.Portfolio_Client_ID = lstM1s[i].Portfolio_Client_ID;
                        oMerged.Sec_Client_ID = lstM1s[i].Sec_Client_ID;
                        oMerged.Tran_Client_LongShort = lstM1s[i].Tran_Client_LongShort.ToUpper();
                        oMerged.WashSales_AssignedFrom_Portfolio_ID = lstM1s[i].WashSales_AssignedFrom_Portfolio_ID;
                        oMerged.WashSales_AssignedFrom_Open_ID = lstM1s[i].WashSales_AssignedFrom_Open_ID;
                        oMerged.WashSales_AssignedFrom_Close_ID = lstM1s[i].WashSales_AssignedFrom_Close_ID;
                        oMerged.WashSales_TackedDays = lstM1s[i].WashSales_TackedDays;
                        oMerged.WashSales_LossDate = lstM1s[i].WashSales_LossDate;
                        oMerged.WashSales_Unique_From_ID = lstM1s[i].WashSales_Unique_From_ID;
                        oMerged.WashSales_Exchange_Adjustment = lstM1s[i].Remain_Quantity / lstM1s[i].NewTran_Quantity * lstM1s[i].WashSales_Exchange_Adjustment;
                        oMerged.WashSales_Capital_Adjustment = lstM1s[i].Remain_Quantity / lstM1s[i].NewTran_Quantity * lstM1s[i].WashSales_Capital_Adjustment;
                        // to be confirmed by Polan 
                        oMerged.SecMasterData = lstM1s[i].SecMasterData;
                        lstMerged.Add(oMerged);
                    }
                }
            }
            foreach (MergedDal m in lstMerged)
            {
                SecMasterDal o = lstSecurities.Find(p => p.Sec_Client_ID == m.Sec_Client_ID);
                if (o != null)
                {
                    m.SecMasterData = o;
                }
            }
            // 
            ProcessMergedList(lstMerged);
        }
        private static void ProcessMergedList(List<MergedDal> MergedTransactionList)
        {
            // logic here to get the dates in required order
            List<MergedDal> lstOpenDateSorted = MergedTransactionList.OrderBy(p => p.Tran_Open_Trade_Date).ToList();
            List<MergedDal> lstCloseDateSorted = MergedTransactionList.OrderBy(p => p.Tran_Close_Trade_Date).ToList();
            Stack<MergedDal> stkOpenDate = new Stack<MergedDal>();
            Stack<MergedDal> stkCloseDate = new Stack<MergedDal>();
            // we will push all sorted transactions in stack and will compare the top most items in both stacks
            for (int i = lstOpenDateSorted.Count; i > 0; i--)
            {
                stkOpenDate.Push(lstOpenDateSorted[i - 1]);
            }
            for (int i = lstCloseDateSorted.Count; i > 0; i--)
            {
                stkCloseDate.Push(lstCloseDateSorted[i - 1]);
            }
            // now the min close date and min open date are at the top of stack 
            MergedDal MinOpenDateTrans = null;
            MergedDal MinCloseDateTrans = null;
            do
            {
                if (MinOpenDateTrans == null && stkOpenDate.Count > 0)
                {
                    MinOpenDateTrans = stkOpenDate.Pop();
                }
                if (MinCloseDateTrans == null && stkCloseDate.Count > 0)
                {
                    MinCloseDateTrans = stkCloseDate.Pop();
                }
                if (MinCloseDateTrans != null && MinOpenDateTrans != null)
                {
                    if (MinOpenDateTrans.Tran_Open_Trade_Date <= MinCloseDateTrans.Tran_Close_Trade_Date)
                    {
                        // do processing
                        // in end 
                        MinOpenDateTrans = null;
                    }
                    else
                    {
                        if (MinCloseDateTrans.Tran_GainLoss_Exchange + MinCloseDateTrans.Tran_GainLoss_Capital + MinCloseDateTrans.WashSales_Exchange_Adjustment + MinCloseDateTrans.WashSales_Capital_Adjustment < 0)
                        {
                            WashScaleCalculation(MinCloseDateTrans, MergedTransactionList);
                        }
                        MinCloseDateTrans = null;
                    }
                }
                else
                {
                    if (MinOpenDateTrans == null && MinCloseDateTrans == null)
                    {
                        break;
                    }
                    if (MinOpenDateTrans == null)
                    {
                        // Check for close event

                        if (MinCloseDateTrans.Tran_GainLoss_Exchange + MinCloseDateTrans.Tran_GainLoss_Capital + MinCloseDateTrans.WashSales_Exchange_Adjustment + MinCloseDateTrans.WashSales_Capital_Adjustment < 0)
                        {
                            WashScaleCalculation(MinCloseDateTrans, MergedTransactionList);
                        }
                        MinCloseDateTrans = null;
                    }
                    else
                    {
                        MinOpenDateTrans = null;
                    }

                }
            }
            while (stkOpenDate.Count > 0 || stkCloseDate.Count > 0);

        }
        private static void WashScaleCalculation(MergedDal MinCloseDateTrans, List<MergedDal> MergedTransactionList)
        {
            DateTime MinDate = !MinCloseDateTrans.Tran_Close_Trade_Date.HasValue ? DateTime.MinValue : MinCloseDateTrans.Tran_Close_Trade_Date.Value.AddDays(-30);
            DateTime MaxDate = !MinCloseDateTrans.Tran_Close_Trade_Date.HasValue ? DateTime.MinValue : MinCloseDateTrans.Tran_Close_Trade_Date.Value.AddDays(30);
            MergedDal TargetItem = null;
            if (MinCloseDateTrans.Tran_Open_Trade_Date.HasValue && MinDate != DateTime.MinValue && MaxDate != DateTime.MinValue)
            {
                TargetItem = MergedTransactionList.Find(p => p.Tran_Open_Trade_Date.Value <= MaxDate && p.Tran_Open_Trade_Date.Value >= MinDate
                    && p.Tran_Client_LongShort.ToUpper() == MinCloseDateTrans.Tran_Client_LongShort.ToUpper()
                    && (p.Sec_Client_ID == MinCloseDateTrans.Sec_Client_ID || (p.SecMasterData != null && p.SecMasterData.Sec_Client_Und_ID == MinCloseDateTrans.Sec_Client_ID))
                    // one comparison missing here for want of explanation 
                    && String.IsNullOrEmpty(MinCloseDateTrans.WashSales_Unique_From_ID));
                if (TargetItem != null)
                {
                    MinCloseDateTrans.WashSales_AssignedTo_Open_ID = TargetItem.Tran_Client_Open_ID;
                    MinCloseDateTrans.WashSales_Unique_To_ID = Guid.NewGuid().ToString();

                    TargetItem.WashSales_AssignedFrom_Open_ID = MinCloseDateTrans.Tran_Client_Open_ID;
                    TargetItem.WashSales_AssignedFrom_Close_ID = MinCloseDateTrans.Tran_Client_Close_ID;
                    TargetItem.WashSales_LossDate = MinCloseDateTrans.Tran_Close_Trade_Date;
                    TargetItem.WashSales_Unique_From_ID = MinCloseDateTrans.WashSales_Unique_To_ID;
                    TargetItem.WashSales_Capital_Adjustment = MinCloseDateTrans.WashSales_Capital_Adjustment + MinCloseDateTrans.Tran_GainLoss_Capital;
                    TargetItem.WashSales_Exchange_Adjustment = MinCloseDateTrans.WashSales_Exchange_Adjustment + MinCloseDateTrans.Tran_GainLoss_Exchange;
                }
            }
            //what and how we need to save . Please answer save related questions from DB
            SaveData();
        }

        private static void SaveData()
        {
            //throw new NotImplementedException();
        }
        private static Decimal GetNullReplacement(Decimal? DecValue)
        {
            if (!DecValue.HasValue)
            {
                return 1;
            }
            else
            {
                return Decimal.Round(DecValue.Value, 4);
            }
        }
        public class MergedDal
        {
            public Int64? SecOrder_ID { get; set; }
            public Int64? Process_ID { get; set; }
            public string Portfolio_Client_ID { get; set; }
            public string Sec_Client_ID { get; set; }
            public string Tran_Option_ASP { get; set; }
            public string Tran_Client_Transaction_Code { get; set; }
            public string Tran_Client_Open_ID { get; set; }
            public DateTime? Tran_Open_Trade_Date { get; set; }
            public string Tran_Client_Close_ID { get; set; }
            public DateTime? Tran_Close_Trade_Date { get; set; }
            public string Tran_Client_LongShort { get; set; }
            public Decimal? Tran_Quantity { get; set; }
            public Decimal? NewTran_Quantity { get; set; }
            public Decimal? Tran_Orig_Cost_Base { get; set; }
            public Decimal? Tran_Amort_Cost_Base { get; set; }
            public Decimal? Tran_ProceedsMarket_Principle_Base { get; set; }
            public Decimal? Tran_GainLoss_Exchange { get; set; }
            public Decimal? Tran_GainLoss_Capital { get; set; }
            public string Tran_GainLoss_Character { get; set; }
            public string Tran_FileType { get; set; }
            public Decimal? WashSales_Exchange_Adjustment { get; set; }
            public Decimal? WashSales_Capital_Adjustment { get; set; }
            public string WashSales_AssignedFrom_Portfolio_ID { get; set; }
            public string WashSales_AssignedFrom_Open_ID { get; set; }
            public string WashSales_AssignedFrom_Close_ID { get; set; }
            public Int32? WashSales_TackedDays { get; set; }
            public DateTime? WashSales_LossDate { get; set; }
            public string WashSales_Unique_From_ID { get; set; }
            public string WashSales_AssignedTo_Open_ID { get; set; }
            public string WashSales_Unique_To_ID { get; set; }
            public SecMasterDal SecMasterData { get; set; }

        }

    }
    public class WCTaxationParam
    {
        public List<M1Dal> lstM1s { get; set; }
        public List<TransactionsDal> lstTransactions { get; set; }
        public List<SecMasterDal> lstSecurities { get; set; }

        public List<CorpActionsDal> lstCorpActions { get; set; }
        public List<DividentsDal> lstDividents { get; set; }
        public List<IdentifiedStraddlesDal> lstIdentifiedStraddles { get; set; }
        public List<InProcessSecurityDal> lstInProcessSecurity { get; set; }

    }
}
